/*
 * @lc app=leetcode.cn id=2206 lang=typescript
 *
 * [2206] 将数组划分成相等数对
 */

// @lc code=start
function divideArray(nums: number[]): boolean {
    let cache = new Map<number, number>();
    nums.forEach((i) => {
        cache.set(i, (cache.get(i) || 0) + 1);
    });
    for (const iterator of cache.values()) {
        if (iterator % 2) return false;
    }
    return true;
}
// @lc code=end
